const express = require("express");
const router = express.Router();
const puppeteer = require('puppeteer');

const MySql = require("../lib/mysql");

router.post("/userPdf",async(req,res,next) => {


    const url = req.body.url;
    const pdfName = req.body.pdfName;
    const value = "F:/Desktop/" + pdfName + ".pdf";
    

    (async () => {    
      const browser = await puppeteer.launch();
      const page = await browser.newPage();
      await page.goto(url);  
      await page.pdf({path: value});
//      await browser.close();
    })();


        res.json({
            code:1,
            message:'简历创建成功',
        })
    

});

module.exports = router;